<?php

/* @project : Template
 * @auther  : 青云
 * @date    : 2018/1/10
 * @desc    : 用户控制器
 */

namespace app\admin\controller;

use think\Request;
use app\common\model\Member as MemberModel;


class Member extends Base
{
    public function index(Request $request)
    {
        $username = $request->username ?? '';

        if ($request->isAjax()) {
            $where[] = ['is_del', 'eq', 0];
            if (!empty($request->username)) {
                $where[] = ['username', 'like', '%' . $username . '%'];
            }

            $this->_search_filter($where);

            $model = new MemberModel();
            $list = $this->_list($model, $where);
            return json($list);
        }

        return $this->fetch();
    }
}
